package com.whxd.framework.common.dto;

import java.io.Serializable;

/**
 * EasyUI分页辅助
 * 
 * @author 张世鹏
 * @since 2013-5-30
 */
public class PageParam implements Serializable{

	private int page = 1;// 当前页

	private int rows = 10;// 每页显示记录数

	private String sort;// 排序字段

	private String order;// asc/desc

	public PageParam(){
		super();
	}

	public PageParam(int page,int rows){
		super();
		this.page = page;
		this.rows = rows;
	}
	
	public PageParam(int page,int rows,String sort,String order){
		super();
		this.page = page;
		this.rows = rows;
		this.sort = sort;
		this.order = order;
	}

	/**
	 * 根据页数和每页数自动计算起始行数
	 * 
	 * @author 张世鹏
	 * @since 2013-6-15
	 * @return
	 */
	public int getFirstResult(){
		return (this.page - 1) * this.rows;
	}

	/**
	 * 返回每页行数
	 * 
	 * @author 张世鹏
	 * @since 2013-7-8
	 * @return
	 */
	public int getMaxResult(){
		return this.rows;
	}

	public int getPage(){
		return page;
	}

	public void setPage(int page){
		this.page = page;
	}

	public int getRows(){
		return rows;
	}

	public void setRows(int rows){
		this.rows = rows;
	}

	public String getSort(){
		return sort;
	}

	public void setSort(String sort){
		this.sort = sort;
	}

	public String getOrder(){
		return order;
	}

	public void setOrder(String order){
		this.order = order;
	}
}